#pragma once

#include <QtWidgets/QWidget>
#include "ui_ComSerialPortWidget.h"

#include "SerialPortControl.h"

QT_BEGIN_NAMESPACE
namespace Ui { class ComSerialPortWidgetClass; };
QT_END_NAMESPACE

#define CONTROL_LAMP_NG "min-width: 28px; min-height: 28px;max-width:28px; max-height: 28px;border-radius: 14px;  border:0px solid black;background:red"
#define CONTROL_LAMP_OK "min-width: 28px; min-height: 28px;max-width:28px; max-height: 28px;border-radius: 14px;  border:0px solid black;background:green"


class ComSerialPortWidget : public QWidget
{
    Q_OBJECT

public:
    ComSerialPortWidget(QWidget *parent = nullptr);
    ~ComSerialPortWidget();

    void initSerialPort();
    void initModbus();

public slots:
    void slot_connStateChange(int state);
    void slot_comportIndexChanged(int index);

private:
    Ui::ComSerialPortWidgetClass *ui;

    SerialPortControl* m_pComDeviceA = NULL;
    SerialPortControl* m_pComDeviceB = NULL;
    QString    m_scan_com_name_A;
    int        m_baudRate = 9600;
};
